﻿<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ page import="nc.bs.ebvp.sourcingcoll.Constants"%>
<%@ page import="nc.bs.ebvp.sourcingcoll.form.PriceDetailForm"%>

<%
	String basePath = request.getContextPath();
	String onlineQuotePk = request.getParameter("onlineQuotePk");
	if(null == onlineQuotePk){
		onlineQuotePk = (String)request.getAttribute("onlineQuotePk");
	}
	String downPercent = request.getParameter("downPercent");
	if(null == downPercent){
		downPercent = (String)request.getAttribute("downPercent");
	}
	String downPrice = request.getParameter("downPrice");
	if(null == downPrice){
		downPrice = (String)request.getAttribute("downPrice");
	}
	String downPercentMny = request.getParameter("downPercentMny");
	if(null == downPercentMny){
		downPercentMny = (String)request.getAttribute("downPercentMny");
	}
	String downPriceMny = request.getParameter("downPriceMny");
	if(null == downPriceMny){
		downPriceMny = (String)request.getAttribute("downPriceMny");
	}
	String lowPrice = request.getParameter("lowPrice");
	if(null == lowPrice){
		lowPrice = (String)request.getAttribute("lowPrice");
	}
	String mnyPrecision = request.getParameter("mnyPrecision");
	if(null == mnyPrecision){
		mnyPrecision = (String)request.getAttribute("mnyPrecision");
	}
	String pricePrecision = request.getParameter("pricePrecision");
	if(null == pricePrecision){
		pricePrecision = (String)request.getAttribute("pricePrecision");
	}
%>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	</head>
	<body class="fullbody">
		<form id="quotepolicy" name="quotepolicy" method="post" action="<%=basePath%>/sourcing/biddingprojlist/quotepolicy">
		<input type="hidden" id="onlineQuotePk" name="onlineQuotePk" value="<%=onlineQuotePk%>" />
		<div class="context">
			<div class="position">
				<div class="tposi">
					当前位置：
					<a href="<%=basePath%>/infopub/pubmain" class="linkstyle">首页</a>&nbsp;&gt;&gt;&nbsp;
					<a href="<%=basePath%>/sourcing/projlist" class="linkstyle">我的投标\谈判\询价</a>&nbsp;&gt;&gt;&nbsp;
					<a href="<%=basePath%>/sourcing/biddingprojlist" class="linkstyle">进行中的项目</a>&nbsp;&gt;&gt;&nbsp;
					<a href="<%=basePath%>/sourcing/biddingprojlist/projexec?pk_pur_project=" class="linkstyle">${PURPROJECT_FORM.project_name}</a>&nbsp;&gt;&gt;&nbsp;
					<a href="<%=basePath%>/sourcing/biddingprojlist" class="linkstyle">在线竞价室</a>&nbsp;&gt;&gt;&nbsp;
					<span class="curposition">设置降价策略</span>
				</div>
				<div class="help">
					<a href="javascript:void(null);" onclick="doHelp('<%=request.getContextPath()%>/help/html/ZXJJ.html');" class="linkstyle">帮助</a>
				</div>
			</div>
			<div class="margin8">
			</div>
			<div class="subpage_title">
				<div class="title_index">
					<img src="<%=basePath%>/images/common/dot03.gif" alt="" border="0" />&nbsp;&nbsp;${PURPROJECT_FORM.project_name}
				</div>
				<div class="rollback">
					<a href="<%=basePath%>/sourcing/biddingprojlist" class="linkstyle">&lt;&lt;&nbsp;返回进行中的项目</a>
				</div>
			</div>
			<div class="margin10">
			</div>
			<div class="password">
				<div class="title">
					<p align="center">
						设置降价策略
					</p>
				</div>
				<div class="lineconner1">
					<div class="left1">
						<img src="<%=basePath%>/images/conner/a_01.png" alt="" />
					</div>
					<div class="right1">
						<img src="<%=basePath%>/images/conner/b_01.png" alt="" />
					</div>
					<div class="c_context">
						<div class="pricetype">
							<div class="text1">
								
							</div>
							<div class="margin10">
							</div>
							<div class="text1">
								设置降价策略后，每轮报价会根据策略在上轮基础上自动降价
							</div>
							<div class="margin10">
							</div>
							<div class="text1">
								每次每种产品单价降价：
								<input type="text" class="textin" size="10" name="down_percent" id="down_percent" value="<%=downPercent%>" onchange="subReduNum(this,2);" onkeypress="javascript:keyPress(this);" />
								% 或
								<input type="text" class="textin" size="10" name="down_price" id="down_price" value="<%=downPrice%>" onchange="subReduNum(this,'<%=pricePrecision%>');" onkeypress="javascript:keyPress(this);" />
								元
								<span class="zhu">注：降价百分比或降价金额选择其一填写</span>
							</div>
							<div class="margin10">
							</div>
							<div class="text1">
								每次每种产品金额降价：
								<input type="text" class="textin" size="10" name="down_percent_mny" id="down_percent_mny" value="<%=downPercentMny%>" onchange="subReduNum(this,2);" onkeypress="javascript:keyPress(this);" />
								% 或
								<input type="text" class="textin" size="10" name="down_price_mny" id="down_price_mny" value="<%=downPriceMny%>" onchange="subReduNum(this,'<%=mnyPrecision%>');" onkeypress="javascript:keyPress(this);" />
								元
								<span class="zhu">注：降价百分比或降价金额选择其一填写</span>
							</div>
							<div class="margin10">
							</div>
							<div class="text1">
								总价警戒值
								<input type="text" class="textin" size="10" name="low_price" id="low_price" value="<%=lowPrice%>" onchange="subReduNum(this,'<%=mnyPrecision%>');" onkeypress="javascript:keyPress(this);" />
								元
							</div>
							<div class="margin10">
							</div>
							<div class="margin10">
							</div>
						</div>
					</div>
					<div class="left2">
						<img src="<%=basePath%>/images/conner/c_01.png" alt="" />
					</div>
					<div class="right2">
						<img src="<%=basePath%>/images/conner/d_01.png" alt="" />
					</div>
				</div>
				<div class="margin20">
				</div>
				<div class="margin10">
					<div id="errorM" class="msgcolor">
						<c:out value="${ERROR_MESSAGE}"></c:out>
					</div>
				</div>
				<div class="cbuttonrow">
					<p align="center">
					<input type="button" class="buttonok" value="确认" onclick="doConfirm();" />
				</div>
				<div class="margin20">
				</div>
			</div>
		</div>
		<input type="hidden" name="mnyPrecision" value="<%=mnyPrecision%>" />
		<input type="hidden" name="pricePrecision" value="<%=pricePrecision%>" />
		</form>
		<script language="javascript">
			function doConfirm(){
				var isMnyDown = "N";
				var downPercent = document.quotepolicy.down_percent.value;
				var downPrice = document.quotepolicy.down_price.value;
				var downPercentMny = document.quotepolicy.down_percent_mny.value;
				var downPriceMny = document.quotepolicy.down_price_mny.value;
				var lowPrice = document.quotepolicy.low_price.value;
				if(trim(downPercent) == "" && trim(downPrice) == "" 
					&& trim(downPercentMny) == "" && trim(downPriceMny) == ""){
					alert("请输入降价百分比或降价金额中的一项！");
					return;
				}
				if((trim(downPercent) != "" || trim(downPrice) != "") 
					&& (trim(downPercentMny) != "" || trim(downPriceMny) != "")){
					alert("单价降价和金额降价只能选择一种！");
					return;
				}
				if((trim(downPercent) != "" && trim(downPrice) != "")
					|| (trim(downPercentMny) != "" && trim(downPriceMny) != "")){
					alert("只能输入降价百分比或降价金额中的一项！");
					return;
				}
				if(trim(lowPrice) == ""){
					alert("请输入总价警戒值！");
					return;
				}
				if(trim(downPercentMny) != "" || trim(downPriceMny) != ""){
					isMnyDown = "Y";
				}
				window.opener.quoteform.is_mny_down.value = isMnyDown;
				window.opener.quoteform.down_percent.value = downPercent;
				window.opener.quoteform.down_price.value = downPrice;
				window.opener.quoteform.down_percent_mny.value = downPercentMny;
				window.opener.quoteform.down_price_mny.value = downPriceMny;
				window.opener.quoteform.low_price.value = lowPrice;
				document.quotepolicy.submit();
			}
			var downPercents = document.getElementsByName("down_percent");
			subReduNum(downPercents[0],2);
			var downPrices = document.getElementsByName("down_price");
			subReduNum(downPrices[0],'<%=pricePrecision%>');
			var downPercentsMny = document.getElementsByName("down_percent_mny");
			subReduNum(downPercentsMny[0],2);
			var downPricesMny = document.getElementsByName("down_price_mny");
			subReduNum(downPricesMny[0],'<%=mnyPrecision%>');
			var lowPrices = document.getElementsByName("low_price");
			subReduNum(lowPrices[0],'<%=mnyPrecision%>');
		</script>
	</body>
</html>
